<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>
  Class: Sorting::Descending
  
    &mdash; Documentation by YARD 0.8.4.1
  
</title>

  <link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" charset="utf-8" />

  <link rel="stylesheet" href="../css/common.css" type="text/css" media="screen" charset="utf-8" />

<script type="text/javascript" charset="utf-8">
  hasFrames = window.top.frames.main ? true : false;
  relpath = '../';
  framesUrl = "../frames.html#!" + escape(window.location.href);
</script>


  <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>

  <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>


  </head>
  <body>
    <div id="header">
      <div id="menu">
  
    <a href="../_index.html">Index (D)</a> &raquo;
    <span class='title'><span class='object_link'><a href="../Sorting.html" title="Sorting (module)">Sorting</a></span></span>
     &raquo; 
    <span class="title">Descending</span>
  

  <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
</div>

      <div id="search">
  
    <a class="full_list_link" id="class_list_link"
        href="../class_list.html">
      Class List
    </a>
  
    <a class="full_list_link" id="method_list_link"
        href="../method_list.html">
      Method List
    </a>
  
    <a class="full_list_link" id="file_list_link"
        href="../file_list.html">
      File List
    </a>
  
</div>
      <div class="clear"></div>
    </div>

    <iframe id="search_frame"></iframe>

    <div id="content"><h1>Class: Sorting::Descending
  
  
  
</h1>

<dl class="box">
  
    <dt class="r1">Inherits:</dt>
    <dd class="r1">
      <span class="inheritName"><span class='object_link'><a href="Ascending.html" title="Sorting::Ascending (class)">Ascending</a></span></span>
      
        <ul class="fullTree">
          <li>Object</li>
          
            <li class="next"><span class='object_link'><a href="Ascending.html" title="Sorting::Ascending (class)">Ascending</a></span></li>
          
            <li class="next">Sorting::Descending</li>
          
        </ul>
        <a href="#" class="inheritanceTree">show all</a>
      
      </dd>
    
  
  
    
  
    
  
  
  
    <dt class="r2 last">Defined in:</dt>
    <dd class="r2 last">lib/sorting/descending.rb</dd>
  
</dl>
<div class="clear"></div>

<h2>Overview</h2><div class="docstring">
  <div class="discussion">
    
  <div class="note notetag">
    <strong>Note:</strong>
    <div class='inline'><p>require &#39;sorting&#39; loads this class</p>
</div>
  </div>

<p>This class is used to implement &#39;desc&#39; (descending) sorting.
You should not need to use this class directly.
You can <code>require &#39;sorting/convenience&#39;</code> and then use Kernel#desc,
or you can <code>require &#39;sorting&#39;</code> and then use Sorting#desc (which
is a module_function, and hence available as Sorting::desc)</p>


  </div>
</div>
<div class="tags">
  

  <p class="tag_title">See Also:</p>
  <ul class="see">
    
      <li><span class='object_link'><a href="Helpers.html" title="Sorting::Helpers (module)">Sorting::Helpers is a module which provides you with a convenient .desc forwarding method</a></span></li>
    
      <li><span class='object_link'><a href="../Sorting.html#desc-class_method" title="Sorting.desc (method)">Sorting.desc is the common way to create a Sorting::Descending instance, or if you required 'sorting/convenience', then plain asc via Kernel#desc</a></span></li>
    
      <li><span class='object_link'><a href="Ascending.html" title="Sorting::Ascending (class)">Sorting::Ascending is the opposite of Sorting::Descending</a></span></li>
    
  </ul>

</div>
  <h2>Constant Summary</h2>
  



  <h2>Constant Summary</h2>
  
  <h3 class="inherited">Constants inherited
     from <span class='object_link'><a href="Ascending.html" title="Sorting::Ascending (class)">Ascending</a></span></h3>
  <p class="inherited"><span class='object_link'><a href="Ascending.html#NilsValues-constant" title="Sorting::Ascending::NilsValues (constant)">Ascending::NilsValues</a></span></p>




  <h2>Instance Attribute Summary</h2>
  
  <h3 class="inherited">Attributes inherited from <span class='object_link'><a href="Ascending.html" title="Sorting::Ascending (class)">Ascending</a></span></h3>
  <p class="inherited"><span class='object_link'><a href="Ascending.html#treat_nils-instance_method" title="Sorting::Ascending#treat_nils (method)">#treat_nils</a></span></p>


  
    <h2>
      Instance Method Summary
      <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
    </h2>

    <ul class="summary">
      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#%3C%3D%3E-instance_method" title="#&lt;=&gt; (instance method)">- (-1, ...) <strong>&lt;=&gt;</strong>(other) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Works reversed to how &lt;=&gt; works normally, i.e.</p>
</div></span>
  
</li>

      
    </ul>
  


  
  
  
  
  
  
  
  
  <h3 class="inherited">Methods inherited from <span class='object_link'><a href="Ascending.html" title="Sorting::Ascending (class)">Ascending</a></span></h3>
  <p class="inherited"><span class='object_link'><a href="Ascending.html#initialize-instance_method" title="Sorting::Ascending#initialize (method)">#initialize</a></span>, <span class='object_link'><a href="Ascending.html#nils_first%3F-instance_method" title="Sorting::Ascending#nils_first? (method)">#nils_first?</a></span>, <span class='object_link'><a href="Ascending.html#nils_last%3F-instance_method" title="Sorting::Ascending#nils_last? (method)">#nils_last?</a></span>, <span class='object_link'><a href="Ascending.html#value-instance_method" title="Sorting::Ascending#value (method)">#value</a></span></p>

  <div id="constructor_details" class="method_details_list">
  <h2>Constructor Details</h2>
  
    <p class="notice">This class inherits a constructor from <span class='object_link'><a href="Ascending.html#initialize-instance_method" title="Sorting::Ascending#initialize (method)">Sorting::Ascending</a></span></p>
  
</div>


  <div id="instance_method_details" class="method_details_list">
    <h2>Instance Method Details</h2>

    
      <div class="method_details first">
  <h3 class="signature first" id="<=>-instance_method">
  
    - (<tt>-1</tt>, ...) <strong>&lt;=&gt;</strong>(other) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Works reversed to how &lt;=&gt; works normally, i.e. it returns -1 when normal
&lt;=&gt; would return 1, and vice versa.
Comparison. Returns -1, 0, or +1 depending on whether <code>other</code> is greater
than, equal to, or less than <code>self</code>.
Comparison with nil is special cased when #treat_nils is set.
If #treat_nils is :nils_first, it will always return 1, if it is
:nils_last, it will always return -1.
Returns nil when the value could not be compared to with <code>other</code>.</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>-1</tt>, <tt>0</tt>, <tt>1</tt>, <tt>nil</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>Works reversed to how &lt;=&gt; works normally, i.e. it returns -1 when normal
&lt;=&gt; would return 1, and vice versa.
Comparison. Returns -1, 0, or +1 depending on whether <code>other</code> is greater
than, equal to, or less than <code>self</code>.
Comparison with nil is special cased when #treat_nils is set.
If #treat_nils is :nils_first, it will always return 1, if it is
:nils_last, it will always return -1.
Returns nil when the value could not be compared to with <code>other</code>.</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


43
44
45
46
47
48
49
50
51
52
53
54
55
56
57</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/sorting/descending.rb', line 43</span>

<span class='kw'>def</span> <span class='op'>&lt;=&gt;</span><span class='lparen'>(</span><span class='id identifier rubyid_other'>other</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_my_value'>my_value</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span>

  <span class='kw'>if</span> <span class='ivar'>@treat_nils</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_my_value'>my_value</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
    <span class='ivar'>@treat_nils</span> <span class='op'>==</span> <span class='symbol'>:nils_first</span> <span class='op'>?</span> <span class='op'>-</span><span class='int'>1</span> <span class='op'>:</span> <span class='int'>1</span>
  <span class='kw'>else</span>
    <span class='id identifier rubyid_other_value'>other_value</span> <span class='op'>=</span> <span class='id identifier rubyid_other'>other</span><span class='period'>.</span><span class='id identifier rubyid_value'>value</span>

    <span class='kw'>if</span> <span class='ivar'>@treat_nils</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_other_value'>other_value</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
      <span class='ivar'>@treat_nils</span> <span class='op'>==</span> <span class='symbol'>:nils_first</span> <span class='op'>?</span> <span class='int'>1</span> <span class='op'>:</span> <span class='op'>-</span><span class='int'>1</span>
    <span class='kw'>else</span>
      <span class='id identifier rubyid_other_value'>other_value</span> <span class='op'>&lt;=&gt;</span> <span class='id identifier rubyid_my_value'>my_value</span>
    <span class='kw'>end</span>
  <span class='kw'>end</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
  </div>

</div>

    <div id="footer">
  Generated on Sat Feb 23 14:24:55 2013 by
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
  0.8.4.1 (ruby-1.9.3).
</div>

  </body>
</html>